//
//  HYSalonHeaderView.m
//  KaiJing
//
//  Created by lanou on 16/1/15.
//  Copyright © 2016年 HuangZuCui. All rights reserved.
//

#import "HYSalonHeaderView.h"
#import "UIView+WLFrame.h"
#import <UIButton+WebCache.h>
@implementation HYSalonHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {

        _headerImageButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _headerImageButton.frame = CGRectMake(10, 10, (kScreenWidth - 30)/2, (kScreenHeight/ 4) - 20);
        _headerImageButton.titleLabel.numberOfLines = 4;
        _headerImageButton.titleLabel.textAlignment = NSTextAlignmentCenter;
        //_headerImageButton.backgroundColor = kRandomClolor;
        [self addSubview:_headerImageButton];
        
        _heaserRightButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _heaserRightButton.frame = CGRectMake(_headerImageButton.right + 10, _headerImageButton.top, (kScreenWidth - 30)/2, (kScreenHeight/ 4) - 20);
        _heaserRightButton.titleLabel.numberOfLines = 4;
        _heaserRightButton.titleLabel.textAlignment = NSTextAlignmentCenter;
        //_heaserRightButton.backgroundColor = kRandomClolor;
        [self addSubview:_heaserRightButton];

    }
    return self;
}

- (void)setArray:(NSMutableArray *)array {
    _array = array;
    HYSalonModel *leftmodel = array[0];
    [_headerImageButton sd_setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://morguo.com/%@",leftmodel.icon]] forState:(UIControlStateNormal)];
    [_headerImageButton setTitle:leftmodel.name forState:(UIControlStateNormal)];
    HYSalonModel *rightModel = array[1];
    [_heaserRightButton sd_setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://morguo.com/%@",rightModel.icon]] forState:(UIControlStateNormal)];
    [_heaserRightButton setTitle:rightModel.name forState:(UIControlStateNormal)];

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
